﻿Public Class CategoriaNegocio

    Public Function listar() As Collection
        Dim dao As New CategoriaDAO
        Return dao.listar()
    End Function

    Public Function insertar(ByVal nombre As String, ByVal descripcion As String) As Categoria

        Dim modelo As New Categoria()
        modelo.nombre = nombre
        modelo.descripcion = descripcion

        Dim dao As New CategoriaDAO
        Return dao.insertar(modelo)
    End Function


    Public Sub actualizar(ByVal idCategoria As Integer, ByVal nombre As String, ByVal descripcion As String)

        Dim modelo As New Categoria()
        modelo.idCategoria = idCategoria
        modelo.nombre = nombre
        modelo.descripcion = descripcion

        Dim dao As New CategoriaDAO
        dao.actualizar(modelo)
    End Sub

    Public Sub eliminar(ByVal idCategoria As Integer)
        Dim dao As New CategoriaDAO
        dao.eliminar(idCategoria)
    End Sub

    Public Function obtener(ByVal idCategoria As Integer) As Categoria
        Dim dao As New CategoriaDAO
        Return dao.obtener(idCategoria)
    End Function

    Public Function buscarPorNombre(ByVal idproducto As Integer,ByVal nombre As String, ByVal descripcion as string) As Collection
        Dim dao As New CategoriaDAO
        Return dao.buscarPorNombre(nombre)
    End Function

End Class

